Skip to content

Use aws-lc-rs instead of ring for TLS#4734

Closed
kcon-stackav wants to merge 8 commits into
astral-sh:mainfrom
kcon-stackav:kcon-stackav/use-aws-lc-instead-of-ring
Closed

Use aws-lc-rs instead of ring for TLS#4734
kcon-stackav wants to merge 8 commits into
astral-sh:mainfrom
kcon-stackav:kcon-stackav/use-aws-lc-instead-of-ring

Conversation

@kcon-stackav
Copy link
Copy Markdown

Summary

This PR switches the TLS backend used by reqwest from ring to aws-lc to support more SSL certificate signature algorithms (especially P521 algorithms which aren't yet supported by ring: briansmith/ring#1631).

Fixes #4534

Test Plan

I used uv pip install to try installing a package from a private PyPI server whose SSL certificate was signed using the ECDSA SHA-512 certificate signature algorithm and, using the Rust debugger, observed that uv did not fail to install the package due to not supporting the ECDSA SHA-512 certificate signature algorithm.

@kcon-stackav kcon-stackav changed the title Explore using aws-lc-rs instead of ring for TLS Use aws-lc-rs instead of ring for TLS Jul 2, 2024
@zanieb zanieb self-assigned this Jul 2, 2024
@zanieb zanieb added the network Network connectivity e.g. proxies, DNS, and SSL label Jul 2, 2024
Comment thread crates/uv-client/src/base_client.rs Outdated
@zanieb
Copy link
Copy Markdown
Member

zanieb commented Jul 2, 2024

Thanks for the pull request!

@zanieb
Copy link
Copy Markdown
Member

zanieb commented Jul 2, 2024

This Windows failure also looks somewhat problematic (see aws/aws-lc#1477 and example fix)

@kcon-stackav kcon-stackav force-pushed the kcon-stackav/use-aws-lc-instead-of-ring branch from 7f091b3 to 34852fe Compare July 2, 2024 22:07
@kcon-stackav kcon-stackav force-pushed the kcon-stackav/use-aws-lc-instead-of-ring branch from 34852fe to 7fdb31c Compare July 2, 2024 22:20
Comment thread .github/workflows/ci.yml
Comment on lines +85 to +86
- name: "Install nasm"
uses: ilammy/setup-nasm@v1
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zanieb I'm not very familiar with maturin, do you think installing NASM is needed for the build-binaries Windows job too?

windows:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-build') }}
runs-on: windows-latest
strategy:
matrix:
platform:
- target: x86_64-pc-windows-msvc
arch: x64
- target: i686-pc-windows-msvc
arch: x86

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maturin calls cargo build, so they same rules should apply whether it's maturin or not.

Comment thread .github/workflows/ci.yml
@kcon-stackav kcon-stackav marked this pull request as ready for review July 2, 2024 22:38
Comment thread .github/workflows/ci.yml
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.DEV_DRIVE }}/uv" -Recurse

- name: "Install nasm"
uses: ilammy/setup-nasm@v1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self we should audit this action and consider just implementing it ourself if the install is straightforward

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread crates/uv-client/src/base_client.rs Outdated
Comment on lines +142 to +144
if aws_lc_rs::default_provider().install_default().is_err() {
warn_user_once!("Failed to install aws_lc_rs as the default TLS provider.");
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the error attached to the result is just Self and has no information, right?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I understand the error holds the CryptoProvider that was previously installed as the default in that case.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could capture it to say what we're using instead but it doesn't seem critical.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah I thought about doing that but I wasn't sure the CryptoProvider had a nice human-readable name field we could use: https://docs.rs/rustls/latest/rustls/crypto/struct.CryptoProvider.html

@zanieb
Copy link
Copy Markdown
Member

zanieb commented Jul 10, 2024

Sorry this is lingering, I'm just not sure of the trade-offs here since it changes our release pipeline and hasn't been requested by many people.

@kcon-stackav
Copy link
Copy Markdown
Author

Sorry this is lingering, I'm just not sure of the trade-offs here since it changes our release pipeline and hasn't been requested by many people.

No worries, and feel free to close this PR if not enough people are wanting it since I learned that switching from ring to aws-lc-rs doesn't solve my particular problem after all (#4534 (comment)), but I believe #1339 should once it becomes available.

@zanieb zanieb added the needs-decision Undecided if this should be done label Jul 15, 2024
@zanieb
Copy link
Copy Markdown
Member

zanieb commented Jul 19, 2024

I think I'll close for now since this changes our build dependencies and there isn't a compelling reason to switch over at this time. Happy to reconsider in the future.

@zanieb zanieb closed this Jul 19, 2024
@rami3l
Copy link
Copy Markdown

rami3l commented Aug 1, 2024

@zanieb As a part of Rustup's plan for the v1.28.0 release cycle, I've migrated Rustup to aws-lc-rs in rust-lang/rustup#3898 for the very same reason (rust-lang/rustup#3820), and I've been contacting aws-lc's side, providing useful information to help address various issues regarding the cross compilation of this library. I'd love to share more experience with you when we're able to actually ship the build, if you're interested.

@zanieb
Copy link
Copy Markdown
Member

zanieb commented Aug 1, 2024

Thanks @rami3l, I appreciate the heads up and am definitely interested.

@cyberksh
Copy link
Copy Markdown

cyberksh commented Jan 2, 2026

Hello are we planning to add support for this?
If this could be an optional feature for Linux only or we could use the prebuilt NASM modules that are provided by aws-lc-rs

@rami3l
Copy link
Copy Markdown

rami3l commented Jan 2, 2026

Thanks @rami3l, I appreciate the heads up and am definitely interested.

@zanieb Sorry for the long wait, but as you might have noticed, we've been using aws-lc-rs in production for about a year now. The team has been quite responsive in terms of aligning our supported targets so it might be worth it to make the move.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-decision Undecided if this should be done network Network connectivity e.g. proxies, DNS, and SSL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

invalid peer certificate: BadSignature when installing package from private index using ECDSA SHA-512 SSL cert

6 participants